1 From add0d895aa6f66320f9b1d901b66259f4308af04 Mon Sep 17 00:00:00 2001
2 From: Markus Stockhausen <markus.stockhausen@gmx.de>
3 Date: Mon, 4 Aug 2025 04:03:27 -0400
4 Subject: clocksource/drivers/timer-rtl-otto: Do not interfere with interrupts
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 During normal operation the timers are reprogrammed including an
10 interrupt acknowledgement. This has no effect as the whole timer
11 is setup from scratch afterwards. Especially in an interrupt this
12 has already been done by rttm_timer_interrupt().
14 Change the behaviour as follows:
16 - Use rttm_disable_timer() during reprogramming
17 - Keep rttm_stop_timer() for all other use cases.
19 Downstream has already tested and confirmed a patch. See
20 https://github.com/openwrt/openwrt/pull/19468
21 https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/3788
23 Tested-by: Stephen Howell <howels@allthatwemight.be>
24 Tested-by: Bjørn Mork <bjorn@mork.no>
25 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
26 Link: https://lore.kernel.org/r/20250804080328.2609287-4-markus.stockhausen@gmx.de
27 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
29 drivers/clocksource/timer-rtl-otto.c | 6 +++---
30 1 file changed, 3 insertions(+), 3 deletions(-)
32 --- a/drivers/clocksource/timer-rtl-otto.c
33 +++ b/drivers/clocksource/timer-rtl-otto.c
34 @@ -141,7 +141,7 @@ static int rttm_next_event(unsigned long
36 RTTM_DEBUG(to->of_base.base);
37 rttm_bounce_timer(to->of_base.base, RTTM_CTRL_COUNTER);
38 - rttm_stop_timer(to->of_base.base);
39 + rttm_disable_timer(to->of_base.base);
40 rttm_set_period(to->of_base.base, delta);
41 rttm_start_timer(to, RTTM_CTRL_COUNTER);
43 @@ -154,7 +154,7 @@ static int rttm_state_oneshot(struct clo
45 RTTM_DEBUG(to->of_base.base);
46 rttm_bounce_timer(to->of_base.base, RTTM_CTRL_COUNTER);
47 - rttm_stop_timer(to->of_base.base);
48 + rttm_disable_timer(to->of_base.base);
49 rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
50 rttm_start_timer(to, RTTM_CTRL_COUNTER);
52 @@ -167,7 +167,7 @@ static int rttm_state_periodic(struct cl
54 RTTM_DEBUG(to->of_base.base);
55 rttm_bounce_timer(to->of_base.base, RTTM_CTRL_TIMER);
56 - rttm_stop_timer(to->of_base.base);
57 + rttm_disable_timer(to->of_base.base);
58 rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
59 rttm_start_timer(to, RTTM_CTRL_TIMER);